module.exports = (sequelize, DataTypes) => {
  const Subscription = sequelize.define('Subscription', {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    userId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: '关联用户ID'
    },
    cityCode: {
      type: DataTypes.STRING(12),
      allowNull: false,
      comment: '城市编码'
    },
    cityName: {
      type: DataTypes.STRING(32),
      allowNull: false,
      comment: '城市名称'
    },
    pushTime: {
      type: DataTypes.STRING(5),
      defaultValue: '08:00',
      comment: '推送时间，格式HH:mm'
    },
    weatherEnabled: {
      type: DataTypes.BOOLEAN,
      defaultValue: true,
      comment: '是否启用天气推送'
    },
    trafficEnabled: {
      type: DataTypes.BOOLEAN,
      defaultValue: true,
      comment: '是否启用限行推送'
    },
    customContent: {
      type: DataTypes.TEXT,
      comment: '自定义推送内容'
    },
    status: {
      type: DataTypes.TINYINT,
      defaultValue: 1,
      comment: '状态：0-禁用 1-正常'
    }
  }, {
    tableName: 'subscriptions',
    timestamps: true,
    comment: '用户订阅信息表'
  });

  return Subscription;
};